﻿
namespace GrainManage.Proxy.Util
{
    public sealed class UrlUtil
    {
        private static readonly object lockObj = new object();
        private static string host = "http://localhost/";

        /// <summary>
        /// Default value: http://localhost/
        /// </summary>
        public static string Host
        {
            get
            {
                return host;
            }
            set
            {
                lock (lockObj)
                {
                    host = value;
                }
            }
        }

        public static string Generate(System.Reflection.MethodBase method)
        {
            var result = Host + method.DeclaringType.Name.Replace("Proxy", string.Empty) + "/" + method.Name;
            return result;
        }
    }
}
